﻿using EnglishAuction.BUS;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace EnglishAuction
{
    public partial class AuctionLogAdmin : System.Web.UI.Page
    {
        public int Index { get; set; }

        protected void Page_Load(object sender, EventArgs e)
        {
            Index = int.Parse(Request.QueryString["Index"]);


            gvDangDauGia.DataSource = SanPhamBUS.GetListDangDauGiaAdmin();
            gvDangDauGia.DataBind();

            var lstDauGiaThanhCong = SanPhamBUS.GetListDaDauGiaThanhCongAdmin();
            var tmp = from n in lstDauGiaThanhCong
                      select new
                      {
                          SanPhamId = n.Id,
                          TenSanPham = n.TenSanPham,
                          NgayLenSan = n.NgayLenSan,
                          GiaSan = n.GiaSan,
                          GiaThang = NguoiThangCuocBUS.GetNguoiThangCuocBySanPhamId(n.Id).Price,
                          NguoiThang = NguoiThangCuocBUS.GetNguoiThangCuocBySanPhamId(n.Id).Username,
                          NguoiThangId = NguoiThangCuocBUS.GetNguoiThangCuocBySanPhamId(n.Id).UserId,
                          ThanhToan = NguoiThangCuocBUS.GetNguoiThangCuocBySanPhamId(n.Id).Payment,
                          HinhAnh = n.HinhAnh
                      };
            gvDauGiaThanhCong.DataSource = tmp;
            gvDauGiaThanhCong.DataBind();

            gvDauGiaThatBai.DataSource = SanPhamBUS.GetListDaDauGiaThatBaiAdmin();
            gvDauGiaThatBai.DataBind();
            
        }
    }
}